The present invention relates generally to semiconductor microprocessors, to a class of microprocessors known as microcontrollers which perform a broad spectrum of control functions, and more particularly to CMOS semiconductor microcontrollers with on-chip analog to digital conversion capability.
The evolution of microprocessors into complex instruments and machines has led to sophisticated, fast real-time control capability. Large microprocessors of 16 or 32 bit capability with associated interrupt handler chips, programmable timer chips, ROM and RAM chips, have been replaced in many control function instances by single chip microcontrollers with all peripherals embedded on the same chip with the microcontroller. Operation of the chip in an expanded mode enhances the versatility of all on-chip features. Microcontrollers are used in a wide diversity of present-day applications, with new applications found almost daily. In hand-held instruments such as tiny pocket-sized pagers, the microcontroller is responsive to received characters to interpret them, produce an audible signal to notify the user of an incoming message (or not if the user prefers an inaudible mode), and produce multiple messages among the several last of those received on a suitable display, typically an LCD. The microcontroller can also recall from its internal memory any or all of the messages received in a given period of time. Among its other instrumentation uses are those as meters and testers, capable of carrying out thousands of tests, each in a millisecond or less.
Other applications include keyboard controllers for personal computers, in which the microcontroller serves to offload many tasks formerly handled by the processor, including continuous performance of numerous diagnostic procedures and notification to the processor if a problem is detected. Among other personal computer applications, microcontrollers are used in modems for command interpretation and data transmission, in printer buffers for high speed dumping of data in preparation for driving the printer at the appropriate speed, or for color plotters, in color copiers, electronic typewriters, cable television terminal equipment, lawn sprinkling controllers, credit card phone equipment, automotive applications such as engine control modules, antilock braking systems, automobile suspension control for desired designation of ride softness or rigidity according to user preference, and a host of other applications daily by industrial and consumer customers.
A real time microcontroller provides rapid solutions to signal processing algorithms and other numerically intensive computations, controls events such as opening and closing of relays, the position and speed of a motor, and other control functions such as those mentioned above. The central processing unit (CPU) of the microcontroller operates in conjunction with certain peripherals to perform the control function, including devices such as timers, signal ports, and baud rate generators, among others.
The present invention is part of an enhancement of an 8-bit user programmable reduced instruction set computer (RISC-type) microcontroller family manufactured and marketed by Microchip Technology Incorporated of Chandler, Ariz. (assignee of this application) as its PIC.RTM.16C5X family of CMOS (complementary metal-oxide-silicon) EPROM (electrically programmable read-only memory)--based microcontrollers. The enhanced user-programmable single chip device addresses the burgeoning number of embedded control applications requiring economical analog sensing and control applications. The device includes the capability to perform analog-to-digital (A/D) conversion.
Prior art microcontrollers that employ A/D conversion have an inherent problem of supply noise. The principal source of the supply noise problem is the digital switching circuitry. As the microcontroller executes instructions, sudden power dips occur because of the large amount of current being drawn during or at clock edges. It is these power dips or sudden drains of current which cause the supply voltage on power bus to "bounce" producing the noise which in turn affects the conversion result.
The effect on conversion result may be explained as follows. The A/D conversion is based on true voltage, that is, the taking of the voltage down to a certain predetermined bit resolution, on which the conversion process will be performed. If the reference voltage generated from the power supply is changed or changing as the microcontroller performs the conversion, then the conversion result will undergo a related change. The conversion is simply a ratio of the present value of the reference voltage. If that reference value is, say, five volts during a sampling by the sample and hold circuit, it would produce one value upon conversion. However, if the reference voltage were to drop suddenly during conversion of the sample, the ratio resulting from the conversion would produce a corresponding ratiometric decline--an incorrect result. Correspondingly, an error can also occur if the reference voltage were to increase during a conversion.
FIG. 1 is a simplified block diagram of a single CMOS semiconductor chip microcontroller device of the type utilized in conjunction with the present invention, but for purposes of explanation of the problems heretofore encountered it will be assumed for the moment that the invention is not incorporated therein. The device includes a microcontroller 10 and an A/D converter (ADC) 12 fabricated within a single silicon chip 15. The microcontroller and the ADC are powered by supply voltage V.sub.DD which is also V.sub.REF, so it is shown as V.sub.DD /V.sub.REF. The microcontroller has one or more clock inputs 20, and control logic 22 and data bus 25 outputs and inputs to and from the ADC.
FIG. 2 provides a graphic illustration of the noise problem and resulting inaccuracies in the A/D conversion process. The full-range voltage is V.sub.DD /V.sub.REF. With a voltage V.sub.IN --shown on a voltage versus time plot--a comparison is made of that voltage against V.sub.REF. The range is divided into many segments; for example, if an eight bit converter is being used, the range is divided into 256 segments. Suppose V.sub.IN ideally were precisely 125 relative to 256 states, i.e., 125/256, so that it happens to be at the 125th state or between the 125th and 126th states when sampling is performed. During the A/D conversion, V.sub.REF experiences a dip, as a perturbation of the power bus attributable to circuits suddenly becoming active and drawing power when clockings occur. When the reference voltage drops, V.sub.IN cannot be 125/256 based on 5 volts, but instead becomes X/256 based on the new value of V.sub.REF (shown as V.sub.REF '). Despite the change in reference voltage, the circuit will seek to maintain V.sub.IN because that value has been captured internally by the sampling. Rather, the device is now working against the new and different reference level, resulting in an error because the ratio must change to accommodate the sample voltage.
A slightly different way of visualizing the problem is that an ADC associated with an 8-bit microcontroller divides the domain into 256 segments. If the power supply is operating at 5 volts, or, more conveniently for purposes of calculation, 5.12 volts which divides easily into 256, then one LSB (least significant bit) is 20 millivolts (mV). Noise equal to one-half of "1 LSB" value (10 mV here), however, may throw the input analog voltage into the next "bin", causing conversion error. If noise is present on the V.sub.DD supply bus--and the noise is typically considerably greater than 10 mV--a substantial portion of it may be coupled into the converter, and will cause error. In those circumstances, whatever noise couples into the A/D converter must be equal to or greater than 10 mV, which may occur often, to produce a gross error of one LSB.
When a 10-bit ADC is considered, the resolution provided is 1024 parts in 5 volts, so that the factor is no longer 10 mV per LSB, but 5 mV per LSB. And if a 12-bit ADC were used, the division results in 1.25 millivolts for each LSB. Thus, as higher bit devices are employed, the ability to tolerate noise and to provide conversion with acceptable error levels falls off sharply, and even very small perturbations of the power supply bus can become crucial.
In the past, clocking and proximity schemes typically have been used in an attempt to eliminate or at least reduce these problems. In the proximity scheme, the ADC is typically located on one chip physically displaced from the microcontroller located on another chip, such that digital clocking noise through the substrate may be better suppressed, if not eliminated. A variation is to attempt to work out satisfactory ground planes on the printed circuit boards. The clock scheme is a bit more involved. When the microcontroller is clocked during one edge of the input oscillator clock, e.g., the entire chip is clocked on the rising edge of the oscillator waveform--it is desirable to attempt the conversion during the falling edge of the clock. This would be at a point where the power supply is most likely to have stabilized, the quietest point of the process at which to perform the conversion.
Although such schemes are capable of providing some relief of noise problems with lower bit A/D devices for reasons mentioned above, they have not proved entirely successful for assuring high accuracy, resolution and efficiency, and are inadequate as higher bit devices are used.
Therefore, it is a principal object of the present invention to provide apparatus and methods which provide improved accuracy of A/D conversions associated with performance of microcontroller functions, by eliminating noise sources which adversely affect the accuracy.